<!DOCTYPE html>
<html lang="en">

<head>
    <!-- BEGIN META -->
    {include file="public/meta"}
    <!-- END META -->

    <!-- BEGIN STYLESHEET-->
    {include file="public/css"}
    <!-- END STYLESHEET-->

    <title>
        {$current_menu['title']} - {$yun_config.title}
    </title>
</head>

<body>
<!-- BEGIN SECTION -->
<section id="container">
    <!-- BEGIN HEADER -->
    {include file="public/header"}
    <!-- END HEADER -->
    <!-- BEGIN SIDEBAR -->
    {include file="public/sidebar"}
    <!-- END SIDEBAR -->
    <!-- BEGIN MAIN CONTENT -->
    <section id="main-content">
        <!-- BEGIN WRAPPER  -->
        <section class="wrapper z-index-1">
            <!-- TOP MENU ROW  -->
            {include file="public/top_menu"}
            <!-- TOP MENU ROW  -->

            <!-- AUTH GROUP ROW  -->
            <div class="row">
                <div class="col-lg-12">
                    <section class="panel">
                        <header class="panel-heading">
                            <span class="label label-primary">{$current_menu.title}</span>
                            <span class="tools pull-right"> </span>
                        </header>
                        <div class="panel-body">
                            <!-- BTN GROUP-->
                            <div class="clearfix">
                                <div class="btn-group pull-left">
                                    <a href="{:url('add')}" class="btn btn-success green">
                                        <i class="fa fa-plus"></i> 新增角色权限组
                                    </a>
                                </div>
                            </div>
                            <!-- END BTN GROUP -->
                            <table class="table table-striped table-advance table-hover">
                                <thead>
                                <tr>
                                    <th class="text-center"><i class="fa fa-list"></i> ID </th>
                                    <th class="text-center"><i class="fa fa-user"></i> 角色名称 </th>
                                    <th class="text-center hidden-phone"><i class="fa fa-sitemap"></i> 角色下管理员数量 </th>
                                    <th class="text-center"><i class="fa fa-ban"></i> 角色状态 </th>
                                    <th class="text-center hidden-phone"><i class="fa fa-edit"></i> 角色描述 </th>
                                    <th class="text-center hidden-phone"><i class="fa fa-clock-o"></i> 创建时间 </th>
                                    <th class="text-center"><i class="fa fa-calendar-o"></i> 操作 </th>
                                </tr>
                                </thead>
                                <tbody>
                                {volist name="list" id="item"}
                                <tr>
                                    <td class="text-center">{$item.id}</td>
                                    <td class="text-center">{$item.title}</td>
                                    <td class="text-center hidden-phone">{$item.counts}</td>
                                    <td class="text-center">
                                        {if condition="$item['status'] eq 0"}
                                        <span class="label label-danger">禁用</span>
                                        {else /}<span class="label label-success">正常</span>
                                        {/if}
                                    </td>
                                    <td class="text-center hidden-phone">{$item.note}</td>
                                    <td class="text-center hidden-phone">{$item.create_time}</td>
                                    <td class="text-center">
                                        {if condition="$item.id eq 1"}
                                        <button class="btn btn-default btn-xs" title="禁止操作"><li class="fa fa-ban"></li></button>
                                        {else /}
                                        <a href="{:url('edit',['id'=>$item.id])}" class="btn btn-primary btn-xs" title="修改"><li class="fa fa-pencil"></li></a>
                                        {if condition="$item.status eq 1"}
                                        <a val="{:url('lock',['id'=>$item.id,'opt'=>'lock'])}" class="btn btn-warning btn-xs lock" title="锁定禁用"><li class="fa fa-lock"></li></a>
                                        {else /}
                                        <a val="{:url('lock',['id'=>$item.id,'opt'=>'unlock'])}" class="btn btn-info btn-xs unlock" title="解除锁定"><li class="fa fa-unlock"></li></a>
                                        {/if}
                                        <a val="{:url('del',['id'=>$item.id])}" class="btn btn-danger btn-xs del" title="删除"><li class="fa fa-trash-o"></li></a>
                                        {/if}
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                            <!-- PAGE INFO ROW -->
                            <div class="text-right m-r-15">
                                {$list->render()|raw}
                            </div>
                            <!-- END PAGE INFO -->
                        </div>
                    </section>
                </div>
            </div>
            <!-- END AUTH GROUP ROW  -->
        </section>
        <!-- END WRAPPER  -->
    </section>
    <!-- END MAIN CONTENT -->
    <!-- BEGIN FOOTER -->
    {include file="public/footer"}
    <!-- END FOOTER -->
</section>
<!-- END SECTION -->
<!-- BEGIN JS -->
{include file="public/js"}
<!-- INLINE JS RELATED TO THIS PAGE -->
<script type="text/javascript">
    $(function() {
        $(".del").click(function() {
            var url = $(this).attr('val');
            layer.confirm('确定要删除此角色吗？', {
                btn: ['确定', '取消'] //按钮
            }, function() {
                window.location.href = url;
            }, function() {});
        });

        /**
         * 锁定禁用
         */
        $(".lock").click(function () {
            var url = $(this).attr('val');
            layer.confirm('确定要锁定禁用此角色权限组吗？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                window.location.href = url;
            }, function () {
            });
        });

        /**
         * 解除锁定
         */
        $(".unlock").click(function () {
            var url = $(this).attr('val');
            layer.confirm('确定要解除锁定此角色权限组吗？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                window.location.href = url;
            }, function () {
            });
        });
    });
</script>
<!-- END JS -->
</body>

</html>